package linkedList.递归.剑指;

import linkedList.BaseLinkedListTest;
import po.ListNode;

/**
 * @author songZiHao
 * @version 1.0.0
 * @ClassName 剑指Offer反转链表24.java
 * @Description TODO
 * @createTime 2021年03月21日 11:55:00
 */
public class 剑指Offer反转链表24 extends BaseLinkedListTest {
    public static ListNode reverseList(ListNode head) {
        if (head == null || head.next==null) {
            return head;
        }
        ListNode node = reverseList(head.next);
        head.next.next=head;
        head.next=null;
        return node;
    }
}
